package com.highcom.dao.impl;

import com.highcom.dao.BookDao;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component("bookDao") //BookDaoImpl变成bean  id=bookDaoImpl变成bean
@PropertySource(value = {"classpath:jdbc.properties","abc.properties"},ignoreResourceNotFound = true)
@Primary
@DependsOn("userService") //要求该bean使用时必须有指定的bean存在
@Order(1)
public class BookDaoImpl implements BookDao {

    @Value("${jdbc.username}")
    private String userName;

    @Value("${jdbc.password}")
    private String password;

    @Override
    public void save() {
        System.out.println("book dao running...1" + userName +","+ password);
    }
}
